package com.example.testcomposeproject.pages.copy

import androidx.lifecycle.viewModelScope
import com.ioidea.base.mvvm.MvvmBaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject


/**
 * @author: hemin
 * @date: 2024/9/9
 * @Desc:
 */
@HiltViewModel
class CopyViewModel @Inject constructor(
    private val model: CopyModel,
) : MvvmBaseViewModel<CopyContract.Event, CopyContract.State>() {



    private fun lampTest() {
        viewModelScope.launch {
            setEvent(CopyContract.Event.ShowLoadingDialog)

            setEvent(CopyContract.Event.HideLoadingDialog)
        }
    }




    override fun createInitialState(): CopyContract.State =
        CopyContract.State()

    override fun handleEvents(event: CopyContract.Event) {
        when (event) {
            is CopyContract.Event.DevTest -> {
                lampTest()
            }
            is CopyContract.Event.HideLoadingDialog ->hideLoading()
            is CopyContract.Event.ShowLoadingDialog ->  showLoading()
        }
    }

}